ComplexComplex number with overloaded operators
Complex number defined as a record containing real and imaginary part, utilizing operator overloading.
Licensed by the Modelica Association under the 3-Clause BSD License
Copyright © 2010-2020, Modelica Association and contributors
This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the 3-Clause BSD license. For license conditions (including the disclaimer of warranty) visit https://modelica.org/licenses/modelica-3-clause-bsd.
| Name | Description | 
|---|---|
| re | Real part of complex number | 
| im | Imaginary part of complex number | 
| Name | Description | 
|---|---|
| Constructor | |
| Zero-element of addition (= Complex(0)) | |
| Unary and binary minus | |
| Multiplication | |
| Add two complex numbers | |
| Divide two complex numbers | |
| Complex power of complex number | |
| Test whether two complex numbers are identical | |
| Test whether two complex numbers are not identical | |
| Transform Complex number into a String representation | 
Constructor
Here the constructor operator(s) is/are defined.
| Name | Description | 
|---|---|
| Construct Complex from Real | 
Construct Complex from Real
This function returns a Complex number defined by real part re and optional imaginary part im (default=0).
| Name | Description | 
|---|---|
| re | Real part of complex number | 
| im | Imaginary part of complex number | 
| Name | Description | 
|---|---|
| result | Complex number | 
Zero-element of addition (= Complex(0))
This function returns the zero-element of Complex, that is, Complex(0) = 0 + j*0.
| Name | Description | 
|---|---|
| result | Complex(0) | 
Unary and binary minus
Here the unary and binary minus operator(s) is/are defined.
| Name | Description | 
|---|---|
| Unary minus (multiply complex number by -1) | |
| Subtract two complex numbers | 
Unary minus (multiply complex number by -1)
This function returns the binary minus of the given Complex number.
| Name | Description | 
|---|---|
| c1 | Complex number | 
| Name | Description | 
|---|---|
| c2 | = -c1 | 
Subtract two complex numbers
This function returns the difference of two given Complex numbers.
| Name | Description | 
|---|---|
| c1 | Complex number 1 | 
| c2 | Complex number 2 | 
| Name | Description | 
|---|---|
| c3 | = c1 - c2 | 
Multiplication
Here the multiplication operator(s) is/are defined.
| Name | Description | 
|---|---|
| Multiply two complex numbers | |
| Scalar product c1*c2 of two complex vectors | 
Multiply two complex numbers
This function returns the product of two given Complex numbers.
| Name | Description | 
|---|---|
| c1 | Complex number 1 | 
| c2 | Complex number 2 | 
| Name | Description | 
|---|---|
| c3 | = c1*c2 | 
Scalar product c1*c2 of two complex vectors
This function returns the scalar product of two given arrays of Complex numbers.
| Name | Description | 
|---|---|
| c1[:] | Vector of Complex numbers 1 | 
| c2[size(c1, 1)] | Vector of Complex numbers 2 | 
| Name | Description | 
|---|---|
| c3 | = c1*c2 | 
Add two complex numbers
This function returns the sum of two given Complex numbers.
| Name | Description | 
|---|---|
| c1 | Complex number 1 | 
| c2 | Complex number 2 | 
| Name | Description | 
|---|---|
| c3 | = c1 + c2 | 
Divide two complex numbers
This function returns the quotient of two given Complex numbers.
| Name | Description | 
|---|---|
| c1 | Complex number 1 | 
| c2 | Complex number 2 | 
| Name | Description | 
|---|---|
| c3 | = c1/c2 | 
Complex power of complex number
This function returns the given Complex numbers c1 to the power of the Complex number c2.
| Name | Description | 
|---|---|
| c1 | Complex number | 
| c2 | Complex exponent | 
| Name | Description | 
|---|---|
| c3 | = c1^c2 | 
Test whether two complex numbers are identical
This function tests whether two given Complex numbers are equal.
| Name | Description | 
|---|---|
| c1 | Complex number 1 | 
| c2 | Complex number 2 | 
| Name | Description | 
|---|---|
| result | c1 == c2 | 
Test whether two complex numbers are not identical
This function tests whether two given Complex numbers are not equal.
| Name | Description | 
|---|---|
| c1 | Complex number 1 | 
| c2 | Complex number 2 | 
| Name | Description | 
|---|---|
| result | c1 <> c2 | 
Transform Complex number into a String representation
This function converts a given Complex number to String representation.
| Name | Description | 
|---|---|
| c | Complex number to be transformed in a String representation | 
| name | Name of variable representing sqrt(-1) in the string | 
| significantDigits | Number of significant digits that are shown | 
| Name | Description | 
|---|---|
| s |